<?php
ob_start();
header('Content-type:text/html; charset=utf-8');
$g4_path = '..';
set_include_path(get_include_path().PATH_SEPARATOR.$g4_path."/lib");
$lib =  "$g4_path/lib.php";
require_once ("$g4_path/common.php");
require_once ($lib);
require_once ('Template_.class.php');

$tpl = new Template_;
$tpl->template_dir = './tpl';
$tpl->compile_dir = './tpl/compile';

extract($_GET);

$sql = "SELECT c.starttime, c.name, g.mb_hp, g.mb_nick, g.mb_name FROM course c, g4_member g WHERE c.teacher = g.mb_no AND c.teacher = $teacher AND c.month = $month AND c.year = $year AND c.$dow > 0";
$res = mysql_query($sql);
$data = array();
list($totalCount) = mysql_fetch_row(mysql_query($sql));
$totalCount = 1;
while($temp = mysql_fetch_assoc($res)) {
        $div = array();
        if($temp['starttime'] > 12) {
            $div[0] = $div[1] = '오후';
            $temp['starttime'] = $temp['starttime'] - 12;
            $temp['endtime'] = $temp['starttime']+1;
            if($temp['endtime'] > 12) {
                $div[] = '오전';
            } 
        } else {
            $div[0] = $div[1] = '오전';
            $temp['endtime'] = $temp['starttime']+1;
            if($temp['endtime']  > 12) {
               $div[1] = '오후'; 
            }
        }
        $temp['starttime'] = $div[0].$temp['starttime'];
        $temp['endtime'] = $div[1].$temp['endtime'];
        $temp['count'] = $totalCount++;
        $data[] = $temp;
}
$tpl->define('basic', 'pop_timetable_detail.html');
$tpl->print_('basic');
